package com.moyangfenghun.javabase.exception;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统一异常处理
 *
 * @author gaofan@youngbai.com
 * @date Created in 2021/1/12 0012 14:38
 */
@Slf4j
@ControllerAdvice
@RestController
public class GlobalExceptionHandler {

    /**
     * 运行时异常处理
     *
     * @return * @return com.decorate.common.api.CommonResult<java.lang.String>
     * @date 2021/5/17 0017 11:04
     */
//    @ExceptionHandler
//    public SaResult handlerException(Exception e){
//        log.error(e.getMessage());
//        e.printStackTrace();
//        if(e instanceof NotLoginException){
//            return SaResult.code(502).setMsg(e.getMessage());
//        }
//        return SaResult.error(e.getMessage());
//    }

}